<template>
  <div class="box" @click="$router.push('detail?id='+xgData.id)">
    <div class="gonglue">
      <div class="imgbox" v-if="xgData.images.length">
        <img :src="xgData.images[0]" alt />
      </div>
      <div class="rg">
        <div class="title">{{xgData.title}}</div>
        <div class="xinxi">
          <span class="date">{{newDate}}</span>
          <span class="yuedu">阅读</span>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
var moment = require("moment");
export default {
  props: ["xgData"],
  data() {
    return {
      newDate: "",
    };
  },
  created() {
    this.newDate = moment(this.xgData.created_at).format("YYYY-MM-DD  h:mm");
  },
};
</script>

<style lang="less" scoped>
.box {
  cursor: pointer;
  .gonglue {
    border-bottom: 1px solid #ccc;
    display: flex;
    align-items: center;
    .imgbox {
      width: 100px;
      height: 80px;
      img {
        width: 100%;
        height: 100%;
        object-fit: contain;
      }
    }
    .rg {
      .title {
        font-size: 16px;
        padding: 15px 0;
        overflow: hidden;
      }
      .xinxi {
        font-size: 12px;
        color: #999;
        margin: 15px 0;
      }
    }
  }
}
</style>